<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%><%@ include file="pub/top.jsp"%>
<%@ page import="java.util.List,java.util.Map"%>
<!-- 全局变量 函数定义区 -->
<%!%>
<!-- 实例变量 函数定义区 -->
<%
	//网页title
	String JSPTITLE = "注册用户";
%>
<%@ include file="pub/head.jsp"%>
<!-- 样式添加区 -->
<link rel="stylesheet" href="<%=basePath%>DataTables/datatables.min.css">
<!-- 下右内容区 -->
<style>

</style>

<div class="main-content-inner">
	<div class="breadcrumbs ace-save-state" id="breadcrumbs">
		<ul class="breadcrumb">
			<li><i class="ace-icon fa fa-home home-icon"></i>用户管理</li>
			<li class="active"><%=JSPTITLE%></li>
		</ul>
	</div>
	<div class="page-content">
		<!-- page-header{ -->
		<div class="page-header">
			<!-- table header1{ -->
			<div class="row">
				<div class="col-xs-12">
					<div class="clearfix">
						<div class="pull-right tableTools-container"></div>
						<div class="">
							<div class="btn-group" style="margin-top: 5px">
								<a href="#" class="btn-refresh btn  btn-xs "> <i
									class="im-spinner10 fa-spin"></i> 刷新
								</a>
								<!-- <a data-toggle="collapse" href="#demo" class=" btn  btn-xs ">
									<i class="im-spinner10 fa-spin"></i>搜索
								</a> -->
							</div>
						</div>
					</div>
					<div id="demo" class="panel-collapse collapse ">
						<div class="panel-body well">
							<form>
								<div class="col-lg-12 col-sm-12">
									<button type="submit"
										class="btn btn-success btn-sm  pull-right">
										<span class="ace-icon fa fa-search icon-on-right bigger-110"></span>
										查找
									</button>
								</div>
							</form>
						</div>
					</div>
				</div>
			</div>
			<!-- }table -header1  -->
		</div>
		<!-- }page-header  -->

		<!-- table header2{ -->
		<div class="row">
			<div class="col-xs-9 tablehead2L"></div>
			<div class="col-xs-3 tablehead2R"></div>
		</div>
		<!-- }table -header2  -->
		<!--  table { -->
		<div class="row">
			<div class="col-xs-12">
						<form class="form-horizontal" action="" role="form">
				
					<div class="form-group">
						<label class="col-sm-2 control-label no-padding-right"
							for="form-field-1-1"><i style="color:red">*</i> 注册姓名 </label>
						<div class="col-sm-8">
							<input type="text" id="ualias"  class="width-60" />
						</div>
						<label class="col-sm-2 "> </label>
					</div>
					
					<div class="form-group">
						<label class="col-sm-2 control-label no-padding-right"
							for="form-field-1-1"><i style="color:red">*</i> 注册手机 </label>
						<div class="col-sm-8">
							<input type="text" id="uphone"  class="width-60" />
						</div>
						<label class="col-sm-2 "> </label>
					</div>
					
					<div class="form-group">
						<label class="col-sm-2 control-label no-padding-right"
							for="form-field-1-1"><i style="color:red">*</i> 职位 </label>
						<div class="col-sm-8">
							<select id="roleid" class="width-60" onchange="yhss1()">
								<option value=2>政府管理</option>
								<option value=4>校长</option>
								<option value=8>教师</option>
							</select>
						</div>
						<label class="col-sm-2 "> </label>
					</div>
					
					<div class="form-group">
						<label class="col-sm-2 control-label no-padding-right"
							for="form-field-1-1"><i style="color:red">*</i> 用户角色 </label>
						<div class="col-sm-8">
							<select id="tt" class="width-60">
								<option value=0>普通</option>
								<option value=1>管理者</option>
							</select>
						</div>
						<label class="col-sm-2 "> </label>
					</div>
					
					<div class="form-group">
						<label class="col-sm-2 control-label no-padding-right"
							for="form-field-1-1"><i style="color:red">*</i> 用户所属 </label>
						<div class="col-sm-8">
							<select id="yhss" class="width-60">
								
							</select>
						</div>
						<label class="col-sm-2 "> </label>
					</div>
					   
					<div class="form-group">
						<label class="col-sm-2 control-label no-padding-right"
							for="form-field-1-1"><i style="color:red">*</i>邮箱 </label>
						<div class="col-sm-8">
							<input type="text" id="eml" class="width-60" />
						</div>
						<label class="col-sm-2 "> </label>
					</div>
					
					<div class="form-group">
						<input type="button" class="btn btn-danger btn-block met1 width-60"
								onclick="Adduser()" value="提交注册">
					</div>
					
				</form>
			</div>
		</div>
	</div>
</div>

<a href="#" id="btn-scroll-up"
	class="btn-scroll-up btn btn-sm btn-inverse"> <i
	class="ace-icon fa fa-angle-double-up icon-only bigger-110"></i>
</a>

<%@ include file="pub/bottom.jsp"%>
<!-- 引入组件库 -->
<script src="<%=basePath%>DataTables/datatables.min.js"></script>
<script src="<%=basePath%>js/hyl.page.js"></script>
<script src="<%=basePath%>js/md5.js"></script>
<!-- 自定义脚本 加载区 -->
<script>
$(document).ready(function(){
	yhss1();
})

function yhss1(){
	var roleid = $('#roleid').val();
	$.ajax({
		type : 'get',
		url : '<%=basePath%>admin/Dao/dict_org.jsp',
		data : {"value":roleid},
		success : function(data) {
			var list = JSON.parse(data);
			var html = "";
			for(var i=0;i<list.length;i++){
				html+='<option value="'+list[i].id+'">'+list[i].t0+'</option>';
			}
			$('#yhss').html(html);
		}
	});
}

var flag=0;
//添加用户
function Adduser(){
	var uphone = $('#uphone').val();
	var ualias = $('#ualias').val();
	var roleid = $('#roleid').val();
	var eml = $('#eml').val();
	var yhss = $('#yhss').val();
	var tt = $('#tt').val();
	if((roleid==16)&(uphone==null||uphone==""||ualias==null||ualias==""||yhss==null||yhss=="")){
		alert("必填信息不能为空");
		return;
	}
	flag=1;
	$.ajax({
		type : 'get',
		url : '<%=basePath%>admin/Dao/member_new.jsp',
		data : {"uphone":uphone,"ualias":ualias,"roleid":roleid,"eml":eml,"yhss":yhss,"tt":tt},
		success : function(data) {
			var code = data.replace(/\s+/g,"");
			if(code=="error"){
				alert("该手机已经绑定");
				flag=0;
				return;
			}else if(code=="error2"){
				alert("该单位已经绑定");
				flag=0;
				return;
			}else{
				alert("注册成功!");
				window.location.reload();
			}
		}
	});
}
</script>
